<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class="app-container">
    <el-form id="mvcfm">
      <el-row>
        <el-col :span="7" :xs="24">
          <div class="form-unit">
            <span class="mvc-title-left"> 我的仪表盘 </span>
          </div>
          <div>
            <el-row>
              <el-col :span="24">
                <img src='images/icons/talent/nopic.jpg' />
              </el-col>
            </el-row>
          </div>
        </el-col>
        <el-col :span="16" :xs="24"> 公司 <el-select v-model="s_s.CMID7">
            <el-option label="－－无－－" value='' />
            <el-option v-for="dict in l_firm" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
          </el-select> 人员 <el-select v-model="s_s.CMID8">
            <el-option label="－－无－－" value='' />
            <el-option v-for="dict in s_person" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
          </el-select>
          <el-button @click="getPage(1);" type='primary' size="mini"><i class='fa fa-search'></i>搜索</el-button>
          <el-button @click="gotoPage('/crm/sale/PotentialBusAdd?'+vueparams+'')" type='success' size="mini"><i class='fa fa-plus'></i>增加一个商机</el-button>
          <div>
          </div>
          <div class="form-unit">
            <span class="mvc-title-left"> 商机统计 </span>
          </div>
          <el-table :data="pageList" v-loading="loading">
            <el-table-column label="操作" align="center" width='100' type=''>
              <template slot-scope="scope">
                <el-dropdown trigger="click">
                  <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>
                      <el-link @click="gotoPage('/crm/sale/BusOpportunityDet?CMID1='+scope.row.predict_id+''+vueparams+'')">查看明细</el-link>
                    </el-dropdown-item>
                    <el-dropdown-item>
                      <el-link @click="d_pret('&CMID1='+scope.row.predict_id+'')">删除</el-link>
                    </el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
              </template>
            </el-table-column>
            <el-table-column label="商机条形码" prop="predict_barcode">
            </el-table-column>
            <el-table-column label="主题" prop="predict_id">
              <template slot-scope="scope">
                <el-link @click="gotoPage('/crm/sale/BusOpportunityDet?CMID1='+scope.row.predict_id+''+vueparams+'')" type='primary'>{{scope.row.predict_theme}}</el-link>
              </template>
            </el-table-column>
            <el-table-column label="客户" prop="predict_client">
            </el-table-column>
            <el-table-column label="管理人" prop="pname">
            </el-table-column>
            <el-table-column label="月预计销售额" prop="predict_optno">
            </el-table-column>
            <el-table-column label="关闭可能性" prop="reckon_clised">
            </el-table-column>
            <el-table-column label="提醒时间" prop="predict_remindate">
            </el-table-column>
            <el-table-column label="商机描述" prop="predict_des">
            </el-table-column>
            <el-table-column label="经理" prop="client_manager">
            </el-table-column>
          </el-table>
          <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'CartogramBusOpportunity',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams("&CMID5=11&CMODULEID=predict"),
        s_s: {
          CMID7: null,
          CMID8: null,
        },
        l_pret: [],
        l_firm: [],
        s_person: [],
        loading: true,
        pageList: [],
        pageSize: 10,
        total: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.getPage(1);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/cartogramBusOpportunity?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_pret(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/d_pret?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      getPage(page) {
        this.loading = true;
        this.s_s.pageNo = page.page || page;
        this.s_s.pageSize = page.limit || 10;
        request({
          method: 'get',
          url: '/xcapi/VUEAction/crm/sale/PotentialAdmin/l_pret?' + this.vueparams,
          params: this.s_s
        }).then(data => {
          this.loading = false;
          this.pageList = data.rows;
          this.total = data.total;
        })
      },
    },
  }
</script>
